/*
 * @description: 全局配置
 * @Author: Islands
 * @Date: 2024-06-14 15:26:53
 * @LastEditTime: 2024-06-20 18:47:44
 */
import { createApp, defineAsyncComponent } from 'vue'
import App from '@/App.vue';
import { Properties, setupStore, setupRouter, setupI18n } from '@/plugins';
import '@/router/dynamic/index';
import 'uno.css';
import 'animate.css';
import '@/assets/index.css';
//svg引入
import '@/assets/icon/iconfont';
//font-class 引入
import '@/assets/icon/iconfont.css';
const app = createApp(App);
Properties(app);
setupStore(app);
setupRouter(app);
setupI18n(app);
app.mount('#app')


//初始化布局组件
function registerGlobalAsyncComponents(app: any) {
    const modules = import.meta.glob('/src/layouts/Layout/src/**.vue');
    for (const path in modules) {
        const result = path.match(/.*\/(.+).vue$/);
        if (result) {
            const name = result[1];
            const component: any = modules[path];
            app.component(name, defineAsyncComponent(component));
        }
    }
}

registerGlobalAsyncComponents(app)